import pygame



class AtlasTexture:
    """
    裁剪其他surface。
    """

    def __init__(self, path: str) -> None:
        self.__surface: pygame.Surface = pygame.image.load(path).convert_alpha()
        self.__region: pygame.Rect = self.__surface.get_rect().copy()

    def surface(self) -> pygame.Surface:
        return self.__surface.subsurface(self.__region)
    
    def original_surface(self) -> pygame.Surface:
        return self.__surface
    
    def set_region(self, region: pygame.Rect) -> "AtlasTexture":
        self.__region = region
        return self